 /* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.





Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/


#import <Foundation/Foundation.h>
#import <JDCloudOCSDKStreambus/StreambusModel.h>

@implementation Target
-(id) initWithName:(NSString*) name
      recordSize:(NSNumber*)recordSize
      cycle:(NSNumber*)cycle { 
     self.name = name;               
     self.recordSize = recordSize;               
     self.cycle = cycle;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self name])
    {
        [result setValue:[self name] forKey:@"name"];
    }
    if([self recordSize])
    {
        [result setValue:[self recordSize] forKey:@"recordSize"];
    }
    if([self cycle])
    {
        [result setValue:[self cycle] forKey:@"cycle"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.name = [dictionary objectForKey:@"name"];
    self.recordSize = [dictionary objectForKey:@"recordSize"];
    self.cycle = [dictionary objectForKey:@"cycle"];
    return self;
}
 @end
@implementation ConsumerGroup
-(id) initWithId:(NSNumber*) idValue
      name:(NSString*)name
      createdTime:(NSString*)createdTime
      delete:(NSString*)delete
      topicId:(NSNumber*)topicId { 
     self.idValue = idValue;               
     self.name = name;               
     self.createdTime = createdTime;               
     self.delete = delete;               
     self.topicId = topicId;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self idValue])
    {
        [result setValue:[self idValue] forKey:@"id"];
    }
    if([self name])
    {
        [result setValue:[self name] forKey:@"name"];
    }
    if([self createdTime])
    {
        [result setValue:[self createdTime] forKey:@"createdTime"];
    }
    if([self delete])
    {
        [result setValue:[self delete] forKey:@"delete"];
    }
    if([self topicId])
    {
        [result setValue:[self topicId] forKey:@"topicId"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.idValue = [dictionary objectForKey:@"id"];
    self.name = [dictionary objectForKey:@"name"];
    self.createdTime = [dictionary objectForKey:@"createdTime"];
    self.delete = [dictionary objectForKey:@"delete"];
    self.topicId = [dictionary objectForKey:@"topicId"];
    return self;
}
 @end
@implementation Topic
-(id) initWithId:(NSNumber*) idValue
      archived:(NSNumber*)archived
      lifecycle:(NSNumber*)lifecycle
      partitionNum:(NSNumber*)partitionNum
      name:(NSString*)name
      shardNum:(NSNumber*)shardNum
      remark:(NSString*)remark { 
     self.idValue = idValue;               
     self.archived = archived;               
     self.lifecycle = lifecycle;               
     self.partitionNum = partitionNum;               
     self.name = name;               
     self.shardNum = shardNum;               
     self.remark = remark;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self idValue])
    {
        [result setValue:[self idValue] forKey:@"id"];
    }
    if([self archived])
    {
        [result setValue:[self archived] forKey:@"archived"];
    }
    if([self lifecycle])
    {
        [result setValue:[self lifecycle] forKey:@"lifecycle"];
    }
    if([self partitionNum])
    {
        [result setValue:[self partitionNum] forKey:@"partitionNum"];
    }
    if([self name])
    {
        [result setValue:[self name] forKey:@"name"];
    }
    if([self shardNum])
    {
        [result setValue:[self shardNum] forKey:@"shardNum"];
    }
    if([self remark])
    {
        [result setValue:[self remark] forKey:@"remark"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.idValue = [dictionary objectForKey:@"id"];
    self.archived = [dictionary objectForKey:@"archived"];
    self.lifecycle = [dictionary objectForKey:@"lifecycle"];
    self.partitionNum = [dictionary objectForKey:@"partitionNum"];
    self.name = [dictionary objectForKey:@"name"];
    self.shardNum = [dictionary objectForKey:@"shardNum"];
    self.remark = [dictionary objectForKey:@"remark"];
    return self;
}
 @end
@implementation TopicListInfo
-(id) initWithArchived:(NSNumber*) archived
      createdTime:(NSString*)createdTime
      deleted:(NSNumber*)deleted
      idValue:(NSNumber*)idValue
      lifecycle:(NSNumber*)lifecycle
      name:(NSString*)name
      partitionNum:(NSString*)partitionNum
      remark:(NSString*)remark
      shardNum:(NSString*)shardNum
      status:(NSNumber*)status
      topicName:(NSString*)topicName
      uid:(NSString*)uid
      updatedTime:(NSString*)updatedTime
      userPin:(NSString*)userPin
      dataSize:(NSString*)dataSize { 
     self.archived = archived;               
     self.createdTime = createdTime;               
     self.deleted = deleted;               
     self.idValue = idValue;               
     self.lifecycle = lifecycle;               
     self.name = name;               
     self.partitionNum = partitionNum;               
     self.remark = remark;               
     self.shardNum = shardNum;               
     self.status = status;               
     self.topicName = topicName;               
     self.uid = uid;               
     self.updatedTime = updatedTime;               
     self.userPin = userPin;               
     self.dataSize = dataSize;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self archived])
    {
        [result setValue:[self archived] forKey:@"archived"];
    }
    if([self createdTime])
    {
        [result setValue:[self createdTime] forKey:@"createdTime"];
    }
    if([self deleted])
    {
        [result setValue:[self deleted] forKey:@"deleted"];
    }
    if([self idValue])
    {
        [result setValue:[self idValue] forKey:@"id"];
    }
    if([self lifecycle])
    {
        [result setValue:[self lifecycle] forKey:@"lifecycle"];
    }
    if([self name])
    {
        [result setValue:[self name] forKey:@"name"];
    }
    if([self partitionNum])
    {
        [result setValue:[self partitionNum] forKey:@"partitionNum"];
    }
    if([self remark])
    {
        [result setValue:[self remark] forKey:@"remark"];
    }
    if([self shardNum])
    {
        [result setValue:[self shardNum] forKey:@"shardNum"];
    }
    if([self status])
    {
        [result setValue:[self status] forKey:@"status"];
    }
    if([self topicName])
    {
        [result setValue:[self topicName] forKey:@"topicName"];
    }
    if([self uid])
    {
        [result setValue:[self uid] forKey:@"uid"];
    }
    if([self updatedTime])
    {
        [result setValue:[self updatedTime] forKey:@"updatedTime"];
    }
    if([self userPin])
    {
        [result setValue:[self userPin] forKey:@"userPin"];
    }
    if([self dataSize])
    {
        [result setValue:[self dataSize] forKey:@"dataSize"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.archived = [dictionary objectForKey:@"archived"];
    self.createdTime = [dictionary objectForKey:@"createdTime"];
    self.deleted = [dictionary objectForKey:@"deleted"];
    self.idValue = [dictionary objectForKey:@"id"];
    self.lifecycle = [dictionary objectForKey:@"lifecycle"];
    self.name = [dictionary objectForKey:@"name"];
    self.partitionNum = [dictionary objectForKey:@"partitionNum"];
    self.remark = [dictionary objectForKey:@"remark"];
    self.shardNum = [dictionary objectForKey:@"shardNum"];
    self.status = [dictionary objectForKey:@"status"];
    self.topicName = [dictionary objectForKey:@"topicName"];
    self.uid = [dictionary objectForKey:@"uid"];
    self.updatedTime = [dictionary objectForKey:@"updatedTime"];
    self.userPin = [dictionary objectForKey:@"userPin"];
    self.dataSize = [dictionary objectForKey:@"dataSize"];
    return self;
}
 @end
@implementation ParameterList
-(id) initWithPKey:(NSString*) pKey
      pValue:(NSString*)pValue { 
     self.pKey = pKey;               
     self.pValue = pValue;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self pKey])
    {
        [result setValue:[self pKey] forKey:@"pKey"];
    }
    if([self pValue])
    {
        [result setValue:[self pValue] forKey:@"pValue"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.pKey = [dictionary objectForKey:@"pKey"];
    self.pValue = [dictionary objectForKey:@"pValue"];
    return self;
}
 @end
@implementation TopicModel
-(id) initWithTopic:(Topic*) topic
      target:(Target*)target
      parameterList:(NSArray<ParameterList*>*)parameterList { 
     self.topic = topic;               
     self.target = target;               
     self.parameterList = parameterList;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self topic])
    {
        [result setValue:[[self topic] dictionary]forKey:@"topic"];
    }
    if([self target])
    {
        [result setValue:[[self target] dictionary]forKey:@"target"];
    }
    if([self parameterList])
    {
        NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
        for (int i =0 ; i< [[self parameterList] count]; i++) {
            ParameterList* item = [[self parameterList] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"parameterList"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.topic = [[Topic alloc]initWithDic:[dictionary objectForKey:@"topic"]];
    self.target = [[Target alloc]initWithDic:[dictionary objectForKey:@"target"]];
    NSArray* parameterListArray = [dictionary objectForKey:@"parameterList"];
    if(parameterListArray&&![parameterListArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [parameterListArray count];i++)
        {
            ParameterList* item = [[ParameterList alloc]initWithDic:[parameterListArray objectAtIndex:i]];
            if(item)
            {
                [propertyArray addObject:item];
            }
        }
        self.parameterList = propertyArray;
    }
    return self;
}
 @end
 
 


